<?php

$params = require(__DIR__ . '/params.php');

$modules = [
    'platform' => [
        'class' => 'platform\Module',
        'basePath' => '@platform',
        'defaultRoute' => 'main/index'
    ]
];
foreach (json_decode(APP_DIRS, true) as $dir)
    $modules[$dir] =[
        'class' => 'app\\'.$dir.'\\Module',
        'basePath' => "@app/{$dir}",
        'defaultRoute' => 'main/index'
    ];

return [
    'id' => 'app-sbbs',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'components' => [
        'request' => [
            'csrfParam' => '_csrf-frontend',
            'cookieValidationKey' => 'yinuochuxing',
            'enableCsrfValidation' => false,
        ],
        'session' => [
            'name' => 'MARKETING_SID',
        ],
        'log' => [
            'traceLevel' => 4,
            'targets' => [
                'file' => [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                    'logFile' => '@runtim/log/' . date('Ymd', time()) . '/' . date('H.i', time()) . '.log'

                ]
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'platform/main/error',
            'maxSourceLines' => 20,
        ],
        'urlManager' => require_once __DIR__ . '/route.php',
        "db" => require(__DIR__ . '/db.php'),
        'cache' => [
            'class' => 'yii\caching\FileCache',
            'cachePath' => '@runtim/cache'
        ]
    ],
    'modules' => $modules,
    'params' => $params,
];
